home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / AECUR100.ARJ / WREFRESH.C < prev   
C/C++ Source or Header  |  1990-03-08  |  2KB  |  68 lines

  1. /*------------------------------------------------------------
  2.  * 
  3.  *  wrefresh.c
  4.  * 
  5.  *  copyright (c) 1987,88,89,90 J. Alan Eldridge
  6.  *
  7.  *  this is the window output function
  8.  *
  9.  *----------------------------------------------------------*/
  10.  
  11. #include "curses.h"
  12.  
  13. int
  14. wrefresh(win)
  15. WINDOW  *win;
  16. {
  17.     int row;
  18.     int clearscr = 0;
  19.  
  20.     if (curscr->flags & _WCLEAR) {
  21.         clearscr = 1;
  22.         curscr->flags &= ~_WCLEAR;
  23.     }
  24.  
  25.     if ((win->flags & _WFULLWIN) && (win->flags & _WCLEAR)) {
  26.         clearscr = 1;
  27.         win->flags &= ~_WCLEAR;
  28.     }
  29.  
  30.     if (clearscr)
  31.         vid_clr_scr(curscr->attrib);
  32.     
  33.     if (win == curscr) {
  34.         int maxy, maxx;
  35.         
  36.         maxy = getmaxr(curscr);
  37.         maxx = getmaxc(curscr) + 1;
  38.         for (row = 0; row <= maxy; row++)
  39.             vid_upd_scr(row, 0, curscr->buf[row], maxx);
  40.  
  41.     } else if ((win->flags & _WDIRTY) && win->firsty != INT_MAX) {
  42.         int scrrow, scrcol, cnt, lasty;
  43.         
  44.         row = win->firsty;
  45.         scrcol = win->orgx;
  46.         scrrow = row + win->orgy;
  47.         cnt = win->maxx + 1;
  48.         lasty = win->lasty;
  49.         
  50.         for (; row <= lasty; row++, scrrow++) {
  51.             vid_upd_scr(scrrow, scrcol, win->buf[row], cnt);
  52.             memcpy(curscr->buf[scrrow] + scrcol, win->buf[row], 
  53.                 cnt*sizeof(VIDCHR));
  54.         }
  55.     }
  56.  
  57.     if (win != curscr) {
  58.         curscr->cury = win->orgy + win->cury;
  59.         curscr->curx = win->orgx + win->curx;
  60.         umarkwin(win);
  61.     }
  62.  
  63.     vid_mov_curs(curscr->cury, curscr->curx);
  64.  
  65.     return OK;
  66. }
  67.  
  68.